package mobi.greenplate.theweb.converter;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import mobi.greenplate.theweb.domain.Friend;
//for : enum types (and many-to-one)



@XmlRootElement(name = "friend")
public class FriendConverter {
    private final Friend entity;

    public FriendConverter() {
        this.entity = new Friend();
    }

    public FriendConverter(Friend entity) {
        this.entity = entity;
    }
    
    @XmlTransient
    public Friend getEntity(){
        return entity;
    }

    @XmlElement
    public Long getId() {
        return entity.getId();
    }

    public void setId(Long id) {
        entity.setId(id);
    }
    
    @XmlElement
    public String getUserName() {
        return entity.getUserName();
    }
    
    public void setUserName(String userName) {
        entity.setUserName(userName);
    }

//    @XmlElement
//    public CommunityConverter getCommunity() {
//        return new CommunityConverter(entity.getCommunity());
//    }
//
//    public void setCommunity(CommunityConverter communityConverter) {
//         entity.setCommunity(communityConverter.getEntity());
//    }

    @XmlElement
    public UserConverter getOwner() {
        return new UserConverter(entity.getOwner());
    }

    public void setOwner(UserConverter userConverter) {
        entity.setOwner(userConverter.getEntity());
    }
   
}

